package com.recursivechaos.gamemaster;

import com.recursivechaos.gamemaster.dao.GameSettingsDAO;

/**
 * MAIN BOT SERVICE This launches the extended bot class to play the game. All
 * settings are loaded from the gamesettings db table.
 * 
 * @author Andrew Bell
 * 
 */
public class MainBotService {
	public static void main(String[] args) {
		// Fetch game settings
		GameSettingsDAO settDAO = new GameSettingsDAO();
		String name = settDAO.getStringSetting("IRC_NICK");
		String server = settDAO.getStringSetting("IRC_SERVER");
		String password = settDAO.getStringSetting("IRC_PWD");
		String channel = settDAO.getStringSetting("IRC_DEBUG");
		String debugServer = channel;

		// Connect bot to server
		GameMasterWorker bot = new GameMasterWorker(name, debugServer);
		try {
			bot.setVerbose(true);
			bot.connect(server);
			bot.identify(password);
			bot.joinChannel(channel);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}
